Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rpc): TransactionTrace matches rpc v6 specs #2581

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

hudem1
Copy link
Contributor

@hudem1 hudem1 commented Feb 28, 2025

As agreed, i divide #2563 into 3, one PR for each of the 3 rpc pkgs

Here is the PR for rpcv6 pkg: create rpcv6.TransactionTrace instead of using vm.TransactionTrace

Main modifications:

  • TransactionTrace.ExecutionResources matches specs
  • TransactionTrace.FunctionInvocation.Events matches specs

Question

The specs say TransactionTrace.FunctionInvocation.Messages.To should be a Felt (currently a string in the code):

type OrderedL2toL1Message struct {
	Order   uint64       `json:"order"`
	From    *felt.Felt   `json:"from_address,omitempty"`
	To      string       `json:"to_address"` // todo: make common.Address after fixing starknet-api EthAddress serialisation
	Payload []*felt.Felt `json:"payload"`
}

Is this todo in the struct still valid ?
I can just re-create the type in v6 and define To as a felt instead but i'm just not sure we wanna keep it as a string even in the vm pkg.

Copy link

codecov bot commented Feb 28, 2025

Codecov Report

Attention: Patch coverage is 95.17241% with 14 lines in your changes missing coverage. Please review.

Project coverage is 74.20%. Comparing base (50efd33) to head (42ab5d6).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
rpc/v6/adapters.go 95.45% 11 Missing and 1 partial ⚠️
rpc/v6/trace.go 88.88% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2581      +/-   ##
==========================================
+ Coverage   73.70%   74.20%   +0.50%     
==========================================
  Files         137      138       +1     
  Lines       16711    16849     +138     
==========================================
+ Hits        12317    12503     +186     
+ Misses       3534     3491      -43     
+ Partials      860      855       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rianhughes rianhughes self-requested a review February 28, 2025 12:59
@hudem1 hudem1 changed the title feat(rpcv6): Use rpcv6.TransactionTrace instead of vm.TransactionTrace feat(rpcv6): ExecutionResources match rpc v6 specs Feb 28, 2025
@hudem1 hudem1 changed the title feat(rpcv6): ExecutionResources match rpc v6 specs feat(rpcv6): TransactionTrace match rpc v6 specs Feb 28, 2025
@hudem1 hudem1 changed the title feat(rpcv6): TransactionTrace match rpc v6 specs feat(rpcv6): TransactionTrace matches rpc v6 specs Feb 28, 2025
@rodrigo-pino rodrigo-pino changed the title feat(rpcv6): TransactionTrace matches rpc v6 specs fix(rpc): TransactionTrace matches rpc v6 specs Feb 28, 2025
Copy link
Contributor

@rodrigo-pino rodrigo-pino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks real good. I would like to add a real world test. Is this possible? Something that without this commit would cause the old code to fail

@hudem1
Copy link
Contributor Author

hudem1 commented Mar 1, 2025

The code looks real good. I would like to add a real world test. Is this possible? Something that without this commit would cause the old code to fail

I'm not sure what you mean by real world test. Do you mean an rpc call like starknet_traceTransaction for example ? If so, we do have tests for the different endpoints involving TransactionTrace type. Those tests wouldn't pass anymore without this commit as I've had to update them. That being said, I can definitely add some other tests if necessary !

@hudem1
Copy link
Contributor Author

hudem1 commented Mar 1, 2025

In this PR, I also fixed FunctionInvocation.Messages by creating a struct specific to v6 instead of reusing vm's one :

  • I made the from_address field mandatory, and fixed tests accordingly.
  • The to_address field should be a felt. From the VM, we get a string, so, I had to convert it to a felt in the rpc v6 pkg. I think we could even potentially change this string type for a felt directly in the vm pkg instead. But that's something we could do after the 2 other PRs for v7 and v8 TransactionTrace I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants